package com.dhms.vostok1.database.fault

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.dhms.vostok1.data.fault.FaultLevel
import com.dhms.vostok1.data.fault.FaultTypeItemData
import kotlinx.coroutines.flow.Flow

@Dao
interface FaultDao {

    @Query("SELECT * FROM fault_level")
    fun getFaultLevel(): Flow<List<FaultLevel>>

    @Query("SELECT * FROM fault_type_item_data")
    fun getFaultTypes(): Flow<List<FaultTypeItemData>>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertFaultLevel(plants: List<FaultLevel>)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertFaultTypes(plants: List<FaultTypeItemData>)
}